// 公共方法调用区
	console.log("start")
	function geetdata(url, opation, htmlurl, scripturl, cookies, isLog) {
		$.getJSON(url, opation, function(json){
			// 日志打印模块
//			if(isLog) {
//				console.log("在geetdata函数中opation:");
//				console.info(opation);
//				console.log("在geetdata函数中接收的json.data");
//				console.info(json.data);
//				console.info("在geetdata函数中接收的json数据是");
//				console.log(json);
//			}

			  view(json,  htmlurl, scripturl); // 负责界面显示数据
			  
			  if(cookies != '') {
				  opation.pageCount = json.data.pageCount;
				  opation.total = json.data.total; console.log(opation);
				  saveOpation(cookies, JSON.stringify(opation));   // 负责保存查询数据条件信息
			  }
			 
		})
	}
	function view(json, htmlurl, scripturl) {
		var $varietyContent = $(htmlurl),
	  	varietyHtml = template(scripturl, json);
		$varietyContent.html(varietyHtml);
		
	}
	
	function saveOpation(name, value) {
		$.cookie(name,value,{path:'/'});
	}
	function pre(name, url, htmlurl, scripturl, cookies, isLog) {
		var value = $.cookie(name);
		var opation = JSON.parse(value);
		if(opation.pageNo > 1) {
			opation.pageNo = opation.pageNo - 1;
		}
		geetdata(url, opation, htmlurl, scripturl, name, isLog);
		console.log("在pre函数中opation的内容是")
		console.info(opation);
	}
	function next(name, url, htmlurl, scripturl, cookies, isLog) {
		var value = $.cookie(name);
		var opation = JSON.parse(value);
		if(opation.pageNo < opation.pageCount) {
			opation.pageNo = opation.pageNo + 1;
		}
		geetdata(url, opation, htmlurl, scripturl, name, isLog);
		console.log("在next函数中opation的内容是")
		console.info(opation);
	}
	
	function geetImg(imgUrl, n) {
		if(imgUrl == '') {
			return null;
		}
		if(n=='') {
			return imgUrl;
		}
		var imgurls = new Array();
		imgurls = imgUrl.split(',');
		if(n>imgurls.length+1) {
			alert('传递的参数有误！');
		} else {
			return imgurls[n-1];
		}
		return '';
	}
	template.helper("geetImgByIndex", geetImg);
	
//	function openUrl(url , isNew){
//		alert(url)
//		if(isNew) {
//			window.open(url);
//		} else {
//			window.location.href = url;
//		}
//	
//	
//	}
	
	function geetOpation() {
		var url=location.search;
    	var Request = new Object();
    	if(url.indexOf("?")!=-1){
    	    var str = url.substr(1);//去掉?号
    	    strs = str.split("&");
    	    for(var i=0;i<strs.length;i++){
    	        Request[strs[i ].split("=")[0]]=unescape(strs[i].split("=")[1]);
    	    }
    	}
    	return Request;
    	console.log(id);
	}
	
	console.log("end");
	
	/**
	 * 调用示例：
	 * 1.改变图片选取位置
	 	
		<img src="{{value.imgUrl | geetImgByIndex:'1'}}" alt="图片"/>
	 */
	
	$(function(){
		
		
		
    	// 填充 鸿鑫旗下的公司
    	var par = {
    		id : geetOpation()['id']
    	};
    	geetdata("../../articledetail/list.do", par, "#content", "content_detail", '', true);
		
		
		
		
		
		
		
		
		
		
		
		
	})
	
	
	
	
	
	
	